<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('钱宝代付文件')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                收款账号:
                                <input type="text" name="showScreenNum"/>

                            </li>
                            <li>
                                收款户名：
                                <input type="text" name="screenName"/>
                            </li>
                            <li class="select-time">
                                <label>提现时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-primary multiple disabled" onclick="markingFailed()" shiro:hasPermission="walletDetails:walletDetails:markingFailed">
                    <i class="fa fa-edit"></i> 标记失败
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var orderState = [[${@dict.getType('orderState')}]];
        var nature = [[${@dict.getType('zd_nature')}]];
        var walletStatus = [[${@dict.getType('wallet_status')}]];
        var prefix = ctx + "walletDetails/walletDetails";

        $(function() {
            var options = {
                url: prefix + "/paymentSuccessList",
                exportUrl: prefix + "/exportPayment",
                modalName: "钱宝代付文件",
                clickToSelect:true,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'screenName',
                    title: '收款户名'
                },
                {
                    field: 'showScreenNum',
                    title: '收款账号'
                },
                {
                    field: 'amount',
                    title: '提现金额',
                    formatter: function(value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'nature',
                    title: '账户类型',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(nature, value);
                    }
                },
                {
                    field: 'bankName',
                    title: '收款银行'
                },
                {
                    field: 'bankNum',
                    title: '开户行行号'
                },
                {
                    field: 'createTime',
                    title: '提现时间'
                },
                {
                    field: 'dzAmount',
                    title: '到账金额',
                    formatter: function(value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'serviceCharge',
                    title: '手续费',
                    formatter: function(value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'status',
                    title: '状态',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(walletStatus, value);
                    }
                },
                {
                    field: 'orderstate',
                    title: '交易状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(orderState, value);
                    }
                },
                {
                    field: 'remarks',
                    title: '备注信息'
                }]
            };
            $.table.init(options);
        });

        function markingFailed(){
            var rows = $.table.selectColumns("id");
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.confirm("确认要标记选中的" + rows.length + "条数据吗?", function() {
                var data = { "ids": rows.join() };
                $.operate.submit(prefix + "/markingFailed", "post", "json", data);
            });
        }
    </script>
</body>
</html>